import { defAxios as request } from '@/utils/http'

/**
 * 任务总数数量统计
 * @returns
 */
export const statisticsTask = () => request({
  url: '/index/statisticsTask',
  method: 'GET'
})

/**
 * 任务总数 趋势
 * @returns
 */
export const pilotTaskDate = () => request({
  url: '/index/pilotTaskDate',
  method: 'GET'
})

/**
 * 飞手飞行时长
 * @returns
 */
export const pilotTaskTimeCount = () => request({
  url: '/index/pilotTaskTimeCount',
  method: 'GET'
})

/**
 * 任务状态
 * @returns
 */
export const taskStatusStatistics = () => request({
  url: '/index/taskStatusStatistics',
  method: 'GET'
})

/**
 * 飞手飞行任务数量
 * @returns
 */
export const pilotTaskStatistics = () => request({
  url: '/index/pilotTaskStatistics',
  method: 'GET'
})

/**
 * 平台任务数量
 * @returns
 */
export const platformTasks = () => request({
  url: '/index/platformTasks',
  method: 'GET'
})

/**
 * 最新任务列表
 * @returns
 */
export const newestTask = () => request({
  url: '/index/newestTask',
  method: 'GET'
})

/**
 * 记录登录时间
 * @returns
 */
export const updateLoginTime = () => request({
  url: '/index/updateLoginTime',
  method: 'GET'
})

/**
 * 机场参数
 */
export const fetchInspection = () => request({
  url: '/inspection/list',
  method: 'GET'
})
/**
 * @description: 立即执行任务
 * @return {*}
 */
export const executeTask = (id) => request({
  url: `/inspection/execute/${id}`,
  method: 'POST'
})

/**
 * @description: 创建应急任务
 * @return {*}
 */
export const createTask = (data) => request({
  url: `/accident/create`,
  method: 'POST',
  data
})

/**
 * @description: 获取机场天气等信息
 * @param {*} airportId
 * @return {*}
 */
export const getAirportMsg = (inspectionId) => request({
  url: `/inspection/airportMsg/${inspectionId}`,
  method: 'GET'
})
/**
 * @description: 获取机场天气等信息
 * @param {*} airportId
 * @return {*}
 */
export const getAirportDetail = (airportId) => request({
  url: `/airport/getAirportDetail/${airportId}`,
  method: 'GET'
})
/**
 * @description: 获取机场外部监控
 * @param {*} airportId
 * @return {*}
 */
export const getAirportUrl = (droneId) => request({
  url: `/airport/getAirportVideo/${droneId}`,
  method: 'GET'
})

/**
 * 根据任务ID获取航线
 * @param {*} id
 * @returns
 */
export const routeByTask = (id) => request({
  url: `/airportLine/info/byInspectionId/${id}`,
  method: 'GET'
})

/**
 * 根据航线ID获取航线
 * @param {*} id
 * @returns
 */
export const routeByline = (id) => request({
  url: `/airportLine/${id}`,
  method: 'GET'
})

/**
 * 根据应急事故ID查询航线
 * @param {*} id
 * @returns
 */
export const routeByAccident = (id) => request({
  url: `/airportLine/info/byAccidentId/${id}`,
  method: 'GET'
})
